//
//  Truck.cpp
//  HelloCpp
//
//  Created by Nguyen Cong Huy on 10/28/14.
//
//

#include "Truck.h"
#include "GameManager.h"
#include "CEMoveBySpeed.h"
#include "Road.h"

float Truck::width = 2.5*METTER_TO_POINT;
float Truck::length = 12*METTER_TO_POINT;

Truck::Truck()
{
    setTag(ID_TRUCK);
}

Truck::~Truck()
{
}

bool Truck::init(){
    Vehicle::init();
    
    mainSprite = CCSprite::createWithSpriteFrameName("Truck.png");
    mainSprite->setAnchorPoint(ccp(0, 0));
    addChild(mainSprite);
    
    float realSizeX = length;
    float scaleFactorX = realSizeX/mainSprite->boundingBox().size.width;
    mainSprite->setScaleX(scaleFactorX);
    
    float realSizeY = width;
    float scaleFactorY = realSizeY/mainSprite->boundingBox().size.height;
    mainSprite->setScaleY(scaleFactorY);
    
    setContentSize(mainSprite->boundingBox().size);
    
    return true;
}